package com.smile.service.service;



import com.smile.service.gateway.MqttGateway;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Component;

/**
 * MQTT 消息发送服务
 */
@Component
@RequiredArgsConstructor
public class MqttMessageSender {
    private final MqttGateway mqttGateway;

    /**
     * 发送消息到指定主题
     */
    public void sendMsg(String topic, String msg) {
        mqttGateway.sendMsgToMqtt(topic, msg);
    }

    /**
     * 发送消息到指定主题，支持 QoS
     */
    public void sendMsg(String topic, int qos, String msg) {
        mqttGateway.sendMsgToMqtt(topic, qos, msg);
    }
}
